#include "stdafx.h"

#include "./02. Builder/Builder.h"
#include "./04. Prototype/Prototype.h"

INT _tmain( INT argc, TCHAR * argv[] )
{
	//===========================================================================
	//	02. Builder Pattern.
	//===========================================================================

	//	Billing Message Director
			BillingMessageDirector	directorBillingMessage;
	const	BillingMessage *		pBillingMessage;

	//	Billing Message By ProtoBuf 
	ProtoBufBillingMessageBuilder builderProtoBufBillingMessage;
	directorBillingMessage.SetBuilder( &builderProtoBufBillingMessage );
	directorBillingMessage.Construct();

	pBillingMessage = directorBillingMessage.GetBillingMessage();

	//	Billing Message By XML
	XmlBillingMessageBuilder builderBillingMessage;
	directorBillingMessage.SetBuilder( &builderBillingMessage );
	directorBillingMessage.Construct();

	pBillingMessage = directorBillingMessage.GetBillingMessage();

	//===========================================================================
	//	03. Factory Method Pattern.
	//===========================================================================

	//===========================================================================
	//	04. Prototype Pattern.
	//===========================================================================
	
	MessageFactory messageFactory;

	__time64_t t = 0;
	::GetSystemTimeAsFileTime( ( FILETIME * )&t );

	Message * pGetTimeMessage	= messageFactory.CreateMessage( CMD_TYPE_GET_TIME,	0			);
	Message * pSetTimeMessage	= messageFactory.CreateMessage( CMD_TYPE_SET_TIME,	t			);
	Message * pSetAlarmMessage	= messageFactory.CreateMessage( CMD_TYPE_SET_ALARM,	t + 1000	);

	messageFactory.Release( pGetTimeMessage		);
	messageFactory.Release( pSetTimeMessage		);
	messageFactory.Release( pSetAlarmMessage	);
	
	return 0;
}

